var q6 = "#fUI/RunnerGame.img/RunnerGameUI/UI/Point/2#";
var q1 = "#fUI/SoulUI.img/DungeonMap/icon/dungeonItem/0#";
var status = 0;

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(d, b, a) {
    if (d == -1) {
        cm.dispose()
    } else {
        if (d == 0 && status == 0) {
            cm.dispose()
        }
        if (d == 1) {
            status++
        } else {
            status--
        }
        if (status == 0) {
            var c = "#e#d        " + q6 + " " + cm.getServerName() + " " + q6 + " #n\r\n\r\n#b";
            c += "         #L1#" + q1 + "制作 <核心宝石 1点卷/1个宝石> .#l\r\n";
            c += "         #L2#" + q1 + "制作 <核心碎片 1点卷/1个碎片> .#l\r\n";
            c += "\r\n";
            cm.askMenu(c)
        } else {
            if (status == 1) {
                switch (a) {
                    case 1:
                        if (cm.getPlayer().getCSPoints(1) < 100) {
                            cm.sendOk("抱歉，你没足够的点卷！需要花费100点卷");
                            cm.getPlayer().modifyCSPoints(1, -100);
                            cm.dispose()
                        } else {
                            cm.gainItem(2435770, 100);
                            cm.playerMessage(-1, "已获得100个核心宝石.")
                        }
                        break;
                    case 2:
                        if (cm.getPlayer().getCSPoints(1) < 10000) {
                            cm.sendOk("抱歉，你没足够的点卷！需要花费10000点卷");
                            cm.getPlayer().modifyCSPoints(1, -10000);
                            cm.dispose()
                        } else {
                            cm.getPlayer().gainvCorePiece(10000);
                            cm.playerMessage(-1, "已获得10000核心碎片.")
                        }
                        break
                }
                cm.dispose()
            }
        }
    }
};